export function entryTime(val) {
    let hours = Math.floor(val / 60);
    let minutes = val % 60;
    if (hours) {
        return hours + '小时' + minutes + '分钟'
    }
    return minutes + '分钟'
}

export function getMinuteSecond(val) {
    if (val.length < 17) {
        return "未知时间";
    } else {
        return val.substring(11, 16);
    }
}

export function getYmd(val) {
    return val.split(' ')[0];
}
export function getMd(val) {
    let str = val.split(' ')[0]
    return str.slice(5);
}

export function numFormat(num, digits = 1) {
    var si = [
        { value: 1, symbol: "" },
        { value: 1E3, symbol: "K" },
        { value: 1E4, symbol: "W" }
    ];
    var rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
    var i;
    for (i = si.length - 1; i > 0; i--) {
        if (num >= si[i].value) {
            break;
        }
    }
    return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol;
}


export function weekFormat(num) {
    switch (num) {
        case 1:
            return '星期一'
        case 2:
            return '星期二'
        case 3:
            return '星期三'
        case 4:
            return '星期四'
        case 5:
            return '星期五'
        case 6:
            return '星期六'
        case 7:
            return '星期天'
    }
}

